package net.simflow.swf.analyzer.network.data;

public class Link {
	private Node sender;
	private Node receiver;
	private boolean isControl;

	public Link(Node sender, Node receiver, boolean isControl) {
		this.sender = sender;
		this.receiver = receiver;
		this.isControl = isControl;
	}

	public Node getSender() {
		return sender;
	}

	public Node getReceiver() {
		return receiver;
	}

	public boolean isControl() {
		return isControl;
	}

	public String getShortInfo() {
		StringBuffer str = new StringBuffer();

		str.append(this.getSender().getNameInNetwork());
		str.append("==>");
		str.append(this.getReceiver().getNameInNetwork());

		if (this.isControl) {
			str.append(":C");
		} else {
			str.append(":D");
		}

		return str.toString();
	}

	public String getFullInfo() {
		StringBuffer str = new StringBuffer();

		str.append(this.getSender().getFullInfo());
		str.append("==>");
		str.append(this.getReceiver().getFullInfo());

		if (this.isControl) {
			str.append(",C");
		} else {
			str.append(",D");
		}

		return str.toString();
	}

	@Override
	public String toString() {
		return getFullInfo();

	}
}
